home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(enterFrame){
- _root.char._x += speed;
- bridgeSFX = new Sound(this);
- bridgeSFX.attachSound("bridge");
- if(_root.paus3)
- {
- speed = 0;
- maxspeed = 0;
- }
- if(!_root.paus3)
- {
- grav++;
- _Y = _Y + grav;
- while(_root.ground.hitTest(_X,_Y,true))
- {
- _Y--;
- grav = 0;
- }
- if(this._currentframe != 45)
- {
- if(Key.isDown(_global.rightkey) && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40 && this._currentframe != 25 && this._currentframe != 30 && this._currentframe != 55 && this._currentframe != 60 && this._currentframe != 65 && this._currentframe != 70)
- {
- _xscale = scale;
- speed++;
- _global.faceright = 1;
- _global.faceleft = 0;
- if(speed >= maxspeed)
- {
- speed = maxspeed;
- }
- if(_root.ground.hitTest(_X,_Y + 7,true))
- {
- this.gotoAndStop("run");
- }
- }
- else if(Key.isDown(_global.leftkey) && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40 && this._currentframe != 25 && this._currentframe != 30 && this._currentframe != 55 && this._currentframe != 60 && this._currentframe != 65 && this._currentframe != 70)
- {
- _xscale = - scale;
- speed--;
- _global.faceleft = 1;
- _global.faceright = 0;
- if(speed <= maxspeed * -1)
- {
- speed = maxspeed * -1;
- }
- if(_root.ground.hitTest(_X,_Y + 7,true))
- {
- this.gotoAndStop("run");
- }
- }
- else
- {
- if(speed > 0)
- {
- speed--;
- if(speed <= 0)
- {
- speed = 0;
- }
- }
- else if(speed < 0)
- {
- speed++;
- if(speed >= 0)
- {
- speed = 0;
- }
- }
- if(_root.ground.hitTest(_X,_Y + 3,true) && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40 && this._currentframe != 25 && this._currentframe != 30 && this._currentframe != 50 && this._currentframe != 55 && this._currentframe != 60 && this._currentframe != 65 && this._currentframe != 70)
- {
- this.gotoAndStop("idle");
- }
- }
- spike = 0;
- if(this.hitboxLevel.hitTest(_root.spike1.beg) && _root.spike1.beg._currentframe == 1 && !spike)
- {
- _root.spike1.gotoAndPlay(2);
- if(_global.sounds == 1)
- {
- spike = new Sound(this);
- spike.attachSound("spike");
- spike.start();
- spike = 1;
- }
- else
- {
- spike = 0;
- }
- }
- if(this.hitboxLevel.hitTest(_root.spike1.hitbox) && this._currentframe != 15 && this._currentframe != 20)
- {
- this.gotoAndStop("damage_1");
- _root.camera.health.nextFrame();
- }
- if(this.hitboxLevel.hitTest(_root.spike2.beg) && _root.spike2.beg._currentframe == 1 && !spike)
- {
- _root.spike2.gotoAndPlay(2);
- if(_global.sounds == 1)
- {
- spike = new Sound(this);
- spike.attachSound("spike");
- spike.start();
- spike = 1;
- }
- else
- {
- spike = 0;
- }
- if(this.hitboxLevel.hitTest(_root.spike2.hitbox) && this._currentframe != 15 && this._currentframe != 20)
- {
- this.gotoAndStop("damage_1");
- _root.camera.health.nextFrame();
- }
- }
- if(Key.isDown(p || esc) && !paus3)
- {
- _root.pauseMenu.gotoAndStop(5);
- _root.paus3 = 1;
- }
- if(Key.isDown(_global.upkey) && _root.ground.hitTest(_X,_Y + 7,true) || _root.ground2.hitTest(_X,_Y + 7,true) && grav <= 4)
- {
- grav = - jumpHeight;
- _Y = _Y - 4;
- this.gotoAndStop("jump");
- if(_root.sfxjc._currentframe <= 20)
- {
- _root.sfx.gotoAndPlay("jump1");
- }
- if(_root.sfxjc._currentframe >= 20)
- {
- _root.sfx.gotoAndPlay("jump2");
- }
- }
- attackFrame = ["attack_1","attack_2","attack_4","attack_5"];
- attack = 0;
- if(!Key.isDown(_global.rightkey) && !Key.isDown(_global.leftkey) && !Key.isDown(_global.upkey) && !jumping && !attack)
- {
- if(this._currentframe != 10 && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40 && this._currentframe != 55 && this._currentframe != 60 && this._currentframe != 65 && this._currentframe != 70)
- {
- if(Key.isDown(_global.z) || Key.isDown(_global.spc))
- {
- _root.char.gotoAndStop(attackFrame[random(attackFrame.length)]);
- attack = 1;
- }
- if(Key.isDown(88))
- {
- this.gotoAndStop("attack_3");
- }
- if(Key.isDown(_global.z || _global.spc) && this.hitboxKick.hitTest(_root.box) && _root.box._currentframe != 10 && this._currentframe != 40)
- {
- _root.char.gotoAndStop("kick");
- attack = 1;
- }
- if(Key.isDown(_global.z || _global.spc) && this.hitboxKick.hitTest(_root.box2) && _root.box2._currentframe != 10 && this._currentframe != 40)
- {
- _root.char.gotoAndStop("kick");
- attack = 1;
- }
- if(Key.isDown(_global.z || _global.spc) && this.hitboxKick.hitTest(_root.box3) && _root.box3._currentframe != 10 && this._currentframe != 40)
- {
- _root.char.gotoAndStop("kick");
- attack = 1;
- }
- if(Key.isDown(_global.z || _global.spc) && this.hitboxKick.hitTest(_root.box4) && _root.box4._currentframe != 10 && this._currentframe != 40)
- {
- _root.char.gotoAndStop("kick");
- attack = 1;
- }
- }
- if(this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 40)
- {
- attack = 0;
- }
- }
- if(!attack && this._currentframe != 10 && this._currentframe != 50 && this._currentframe != 15 && this._currentframe != 40 && _root.camera.specialBar._currentframe == 5 && !Key.isDown(_global.rightkey) && !Key.isDown(_global.leftkey))
- {
- if(Key.isDown(_global.a))
- {
- this.gotoAndStop("special");
- attack = 1;
- _root.camera.specialBar.gotoAndStop(1);
- _global.fucker = 0;
- }
- }
- }
- tuska = 25;
- i = 1;
- while(i <= tuska)
- {
- tusk = _root["tusk" + i];
- if(this.hitTest(tusk))
- {
- tusk.gotoAndStop(7);
- _global.score += 1;
- if(_global.sounds == 1)
- {
- tuskPickup = new Sound(this);
- tuskPickup.attachSound("tuskPickup");
- tuskPickup.start();
- }
- }
- i++;
- }
- tuskb = 25;
- i = 1;
- while(i <= tuskb)
- {
- clump = _root["clump" + i];
- if(this.hitTest(clump))
- {
- clump.gotoAndStop(10);
- _global.score += 5;
- if(_global.sounds == 1)
- {
- tuskPickup = new Sound(this);
- tuskPickup.attachSound("tuskPickup");
- tuskPickup.start();
- }
- }
- i++;
- }
- wallsLeft = 20;
- i = 1;
- while(i <= wallsLeft)
- {
- wallLeft = _root["wallLeft" + i];
- if(Key.isDown(37))
- {
- if(wallLeft.hitTest(_X + _width / 2 + ex,_Y - _height / 2,true) || wallLeft.hitTest(_X + _width / 2 + ex,_Y - _height / 6,true) || wallLeft.hitTest(_X + _width / 2 + ex,_Y - _height,true))
- {
- speed = 0;
- }
- }
- i++;
- }
- wallsRight = 20;
- i = 1;
- while(i <= wallsRight)
- {
- wallRight = _root["wallRight" + i];
- if(Key.isDown(39))
- {
- if(wallRight.hitTest(_X + _width / 2 + ex,_Y - _height / 2,true) || wallRight.hitTest(_X + _width / 2 + ex,_Y - _height / 6,true) || wallRight.hitTest(_X + _width / 2 + ex,_Y - _height,true))
- {
- speed = 0;
- }
- }
- i++;
- }
- blubbers = 5;
- i = 1;
- while(i <= blubbers)
- {
- blubber = _root["blubber" + i];
- if(blubber.hitTest(_X,_Y,true) && blubber._currentframe != 1)
- {
- grav = (- jumpHeight) * 2.8;
- blubber.gotoAndStop(10);
- bounce = new Sound(this);
- bounce.attachSound("bounce");
- if(_global.sounds == 1)
- {
- bounce.start();
- }
- }
- i++;
- }
- if(_root.boat.hitTest(_X,_Y,true))
- {
- grav = - jumpHeight;
- bounce = new Sound(this);
- bounce.attachSound("bounce");
- if(_global.sounds == 1)
- {
- bounce.start();
- }
- }
- if(this.hitTest(_root.bridgeHit))
- {
- _root.bridge.gotoAndStop(5);
- _root.ground.gotoAndStop(5);
- }
- if(this.hitTest(_root.key1))
- {
- _root.key1.gotoAndStop(2);
- _root.blubber1.gotoAndStop(5);
- _root.camera.textBlubber.gotoAndStop(2);
- keySound = new Sound(this);
- keySound.attachSound("keySound");
- if(_global.sounds == 1)
- {
- keySound.start();
- }
- }
- if(this.hitTest(_root.key2))
- {
- _root.key2.gotoAndStop(2);
- _root.blubber2.gotoAndStop(5);
- _root.camera.textBlubber.gotoAndStop(2);
- keySound = new Sound(this);
- keySound.attachSound("keySound");
- if(_global.sounds == 1)
- {
- keySound.start();
- }
- }
- if(this.hitTest(_root.key3))
- {
- _root.key3.gotoAndStop(2);
- _root.blubber4.gotoAndStop(5);
- _root.camera.textBlubber.gotoAndStop(2);
- keySound = new Sound(this);
- keySound.attachSound("keySound");
- if(_global.sounds == 1)
- {
- keySound.start();
- }
- }
- if(this.hitTest(_root.fall))
- {
- _root.gotoAndStop("death");
- }
- bears = 10;
- i = 1;
- while(i <= bears)
- {
- bear = _root["bear" + i];
- if(this.attack_1.attackHit.hitTest(bear.hit) && bear._currentframe != 15)
- {
- bear.gotoAndStop("death");
- _global.kills += 1;
- }
- if(this.attack_2.attackHit.hitTest(bear.hit) && bear._currentframe != 15)
- {
- bear.gotoAndStop("death");
- _global.kills += 1;
- }
- if(this.attack_3.attackHit.hitTest(bear.hit) && bear._currentframe != 15)
- {
- bear.gotoAndStop("death");
- _global.kills += 1;
- }
- if(this.attack_4.attackHit.hitTest(bear.hit) && bear._currentframe != 15)
- {
- bear.gotoAndStop("death");
- _global.kills += 1;
- }
- if(this.attack_5.attackHit.hitTest(bear.hit) && bear._currentframe != 15)
- {
- bear.gotoAndStop("death");
- _global.kills += 1;
- }
- if(bear.attack_1.hit.hitTest(this.hitboxLevel) && this._currentframe != 15 && this._currentframe != 20 && this._currentframe != 25 && this._currentframe != 45 && this._currentframe != 50 && this._currentframe != 55 && this._currentframe != 60 && this._currentframe != 65 && this._currentframe != 70)
- {
- this.gotoAndStop("damage_1");
- _root.camera.health.nextFrame();
- }
- i++;
- }
- eagles = 10;
- i = 1;
- while(i <= eagles)
- {
- eagle = _root["eagle" + i];
- if(this.attack_1.attackHit.hitTest(eagle.hit) && eagle._currentframe != 5)
- {
- eagle.gotoAndStop(5);
- _global.kills += 1;
- }
- if(this.attack_2.attackHit.hitTest(eagle.hit) && eagle._currentframe != 5)
- {
- eagle.gotoAndStop(5);
- _global.kills += 1;
- }
- if(this.attack_3.attackHit.hitTest(eagle.hit) && eagle._currentframe != 5)
- {
- eagle.gotoAndStop(5);
- _global.kills += 1;
- }
- if(this.attack_4.attackHit.hitTest(eagle.hit) && eagle._currentframe != 5)
- {
- eagle.gotoAndStop(5);
- _global.kills += 1;
- }
- if(this.attack_5.attackHit.hitTest(eagle.hit) && eagle._currentframe != 5)
- {
- eagle.gotoAndStop(5);
- _global.kills += 1;
- }
- i++;
- }
- mooses = 10;
- i = 1;
- while(i <= mooses)
- {
- moose = _root["moose" + i];
- if(moose.attack.hit.hitTest(this.hitboxLevel))
- {
- if(_global.faceleft)
- {
- this._x += 10;
- if(this._currentframe != 70)
- {
- this.gotoAndStop("knockdown");
- _root.camera.health.nextFrame();
- }
- }
- else if(_global.faceright)
- {
- this._x -= 10;
- if(this._currentframe != 70)
- {
- this.gotoAndStop("knockdown");
- _root.camera.health.nextFrame();
- }
- }
- }
- i++;
- }
- if(_root.ground.hitTest(_X + _width / 2 + ex,_Y - _height / 4,false) || _root.ground.hitTest(_X + _width / 2 + ex,_Y - _height / 12,false) || _root.ground.hitTest(_X + _width / 4 + ex,_Y - _height,false))
- {
- _X = _X - speed;
- }
- if(_root.ground.hitTest(_X - _width / 2 - ex,_Y - _height / 4,false) || _root.ground.hitTest(_X - _width / 2 - ex,_Y - _height / 12,false) || _root.ground.hitTest(_X - _width / 4 - ex,_Y - _height,false))
- {
- _X = _X + speed;
- }
- if(grav >= 5)
- {
- this.gotoAndStop("fall2");
- }
- }
- }
-